
** Replication for "Logic of Sexual Violence by State Security Forces in Civil Wars"
** 12/05/2023
** Analysis run using Stata/SE 16.1 for Mac (Apple Silicon)

sum govt_svhigh govt_loss log_quality rebel_svhigh age intensity pressgang gdppc v2x_polyarchy logpopul fertility 

*** VARIATION GRAPHS
hist govt_svhigh, freq color(blue) width(0.8) scheme(plotplain)
hist govt_loss, freq color(blue) scheme(plotplain)

*** MULTIPLE IMPUTATION 
mi set mlong 
mi register imputed govt_loss log_quality  rebel_svhigh age intensity pressgang gdppc v2x_polyarchy logpopul fertility incomp intervention pk aid_dep
mi impute mvn govt_loss log_quality  rebel_svhigh age intensity pressgang gdppc v2x_polyarchy logpopul fertility incomp intervention pk aid_dep, rseed(12345) add(5) dots
sort conflictid year
mi xtset conflictid year
mi xeq: summarize 

*** LAGGING VARIABLES 
mi xeq: sort conflictid year; gen lag_log_quality=L1.log_quality
mi xeq: sort conflictid year; gen lag_govt_loss=L1.govt_loss
mi xeq: sort conflictid year; gen lag_rebel_svhigh=L1.rebel_svhigh
mi xeq: sort conflictid year; gen lag_age = L1.age
mi xeq: sort conflictid year; gen lag_intensity=L1.intensity
mi xeq: sort conflictid year; gen lag_pressgang=L1.pressgang
mi xeq: sort conflictid year; gen lag_logpopul=L1.logpopul
mi xeq: sort conflictid year; gen lag_gdppc=L1.gdppc
mi xeq: sort conflictid year; gen lag_v2x_polyarchy=L1.v2x_polyarchy
mi xeq: sort conflictid year; gen lag_fertility=L1.fertility
mi xeq: sort conflictid year; gen lag_incomp=L1.incomp 
mi xeq: sort conflictid year; gen lag_conscript=L1.conscript 
mi xeq: sort conflictid year; gen lag_govt_svhigh=L1.govt_svhigh
mi xeq: sort conflictid year; gen lag_rebel_svavg=L1.rebel_svavg
mi xeq: sort conflictid year; gen lag_intervention=L1.intervention
mi xeq: sort conflictid year; gen lag_pk=L1.pk
mi xeq: sort conflictid year; gen lag_aid_dep=L1.aid_dep

*** HYPOTHESIS 1 
mi estimate, post: ologit govt_svhigh lag_govt_loss, cluster(conflictid)
est store m1
mi estimate, post: ologit govt_svhigh  lag_govt_loss lag_log_quality lag_rebel_svhigh lag_age lag_intensity lag_pressgang lag_gdppc lag_v2x_polyarchy lag_logpopul lag_fertility, cluster(conflictid)
est store m2

*** HYPOTHESIS 2
mi estimate, post: ologit govt_svhigh c.lag_govt_loss##c.lag_log_quality, cluster(conflictid)
est store m3
mi estimate, post: ologit govt_svhigh c.lag_govt_loss##c.lag_log_quality lag_rebel_svhigh lag_age lag_intensity lag_pressgang lag_gdppc lag_v2x_polyarchy lag_logpopul lag_fertility, cluster(conflictid)
est store m4
esttab m1 m2 m3 m4 using results.tex, se star(* 0.1 ** 0.05 *** 0.01) stats(N) 

*** PREDICTED PROBABILITIES 
sum log_quality, detail
***10/90 percentile
mi estimate, post: ologit govt_svhigh c.lag_govt_loss##c.lag_log_quality lag_rebel_svhigh lag_age lag_intensity lag_pressgang lag_gdppc lag_v2x_polyarchy lag_logpopul lag_fertility, cluster(conflictid)
mimrgns , predict(outcome (0)) at(lag_log_quality=(7.443666  10.47296) lag_govt_loss=(0 1))
mimrgns , predict(outcome (1)) at(lag_log_quality=(7.443666  10.47296) lag_govt_loss=(0 1))
mimrgns , predict(outcome (2)) at(lag_log_quality=(7.443666  10.47296) lag_govt_loss=(0 1))
mimrgns , predict(outcome (3)) at(lag_log_quality=(7.443666  10.47296) lag_govt_loss=(0 1))

*** 5/95 percentile 
mimrgns , predict(outcome (0)) at(lag_log_quality=(6.90689 10.88322) lag_govt_loss=(0 1))
mimrgns , predict(outcome (1)) at(lag_log_quality=(6.90689 10.88322) lag_govt_loss=(0 1))
mimrgns , predict(outcome (2)) at(lag_log_quality=(6.90689 10.88322) lag_govt_loss=(0 1))
mimrgns , predict(outcome (3)) at(lag_log_quality=(6.90689 10.88322) lag_govt_loss=(0 1))

*** ROBUSTNESS TESTS

*** FIXED EFFECTS 
mi estimate, post: ologit govt_svhigh  lag_govt_loss lag_log_quality lag_rebel_svhigh lag_age lag_intensity lag_pressgang lag_gdppc lag_v2x_polyarchy lag_logpopul lag_fertility i.conflictid, cluster(conflictid)
est store m5
mi estimate, post: ologit govt_svhigh  lag_govt_loss lag_log_quality lag_rebel_svhigh lag_age lag_intensity lag_pressgang lag_gdppc lag_v2x_polyarchy lag_logpopul lag_fertility i.year, cluster(conflictid)
est store m6
mi estimate, post: ologit govt_svhigh c.lag_govt_loss##c.lag_log_quality lag_rebel_svhigh lag_age lag_intensity lag_pressgang lag_gdppc lag_v2x_polyarchy lag_logpopul lag_fertility i.conflictid, cluster(conflictid)
est store m7
mi estimate, post: ologit govt_svhigh c.lag_govt_loss##c.lag_log_quality lag_rebel_svhigh lag_age lag_intensity lag_pressgang lag_gdppc lag_v2x_polyarchy lag_logpopul lag_fertility i.year, cluster(conflictid)
est store m8

esttab m5 m6 m7 m8 using robustfe.tex, se star(* 0.1 ** 0.05 *** 0.01) stats(N) drop (*conflictid* *year*)

*** AVERAGE DV 
mi estimate, post: ologit govt_svavg  lag_govt_loss lag_log_quality lag_rebel_svavg lag_age lag_intensity lag_pressgang lag_gdppc lag_v2x_polyarchy lag_logpopul lag_fertility, cluster(conflictid)
est store m9
mi estimate, post: ologit govt_svavg c.lag_govt_loss##c.lag_log_quality lag_rebel_svavg lag_age lag_intensity lag_pressgang lag_gdppc lag_v2x_polyarchy lag_logpopul lag_fertility, cluster(conflictid)
est store m10

esttab m9 m10 using robustnessave.tex, se star(* 0.1 ** 0.05 *** 0.01) stats(N) 

*** TEMPORAL DEPENDENCE 
mi estimate, post: ologit govt_svhigh  lag_govt_loss lag_log_quality lag_rebel_svhigh lag_age lag_intensity lag_pressgang lag_gdppc lag_v2x_polyarchy lag_logpopul lag_fertility lag_govt_svhigh, cluster(conflictid)
est store m11
mi estimate, post: ologit govt_svhigh c.lag_govt_loss##c.lag_log_quality lag_rebel_svhigh lag_age lag_intensity lag_pressgang lag_gdppc lag_v2x_polyarchy lag_logpopul lag_fertility lag_govt_svhigh, cluster(conflictid)
est store m12

esttab m11 m12 using robustnesstd.tex, se star(* 0.1 ** 0.05 *** 0.01) stats(N) 


*** ADDITIONAL CONTROLS
mi estimate, post: ologit govt_svhigh  lag_govt_loss lag_log_quality lag_rebel_svhigh lag_age lag_intensity lag_pressgang lag_gdppc lag_v2x_polyarchy lag_logpopul lag_fertility lag_incomp lag_intervention lag_pk lag_aid_dep, cluster(conflictid)
est store m13
mi estimate, post: ologit govt_svhigh c.lag_govt_loss##c.lag_log_quality lag_rebel_svhigh lag_age lag_intensity lag_pressgang lag_gdppc lag_v2x_polyarchy lag_logpopul lag_fertility lag_incomp lag_intervention lag_pk lag_aid_dep, cluster(conflictid)
est store m14

esttab m13 m14 using addcontrol.tex, se star(* 0.1 ** 0.05 *** 0.01) stats(N) 
